( function ( D ) {

    if (typeof Object.create !== 'function') {
        Object.create = function (o) {
            function F() {}
            F.prototype = o;
            return new F();
        };
    }

    D.timestamp = function(){
        return (new Date().getTime());
    }

    D.userName = function ( ) 
    {
        return document.getElementById( 'userName' ).innerHTML;
    }

    D.makeControl = function(title, icon, theClass){
    	var control = document.createElement( "a" );
    	control.setAttribute( "href", "" );
	if(theClass){
    		control.setAttribute( "class", theClass );
	} else {
    		control.setAttribute( "class", "control" );
	}
    	control.setAttribute( "title", title );
    	control.innerHTML = icon;
    	return control;
    }

    D.getDocHeight = function ( ) 
    {
        var d = document;

        return Math.max 
        (
            Math.max( d.body.scrollHeight, d.documentElement.scrollHeight ),
            Math.max( d.body.offsetHeight, d.documentElement.offsetHeight ),
            Math.max( d.body.clientHeight, d.documentElement.clientHeight )
        );
    }

    D.getDocWidth = function ( ) 
    {
        var d = document;

        return Math.max 
        (
            Math.max( d.body.scrollWidth, d.documentElement.scrollWidth ),
            Math.max( d.body.offsetWidth, d.documentElement.offsetWidth ),
            Math.max( d.body.clientWidth, d.documentElement.clientWidth )
        );
    }

    D.disableSelection = function ( element ) 
    {
        element.onselectstart = function ( ) 
        {
            return false;
        };

        element.unselectable = "on";
        element.style.MozUserSelect = "none";
        element.style.cursor = "default";
    }

    D.findPosX = function ( obj )
    {
        var curleft = 0;
    
        if( obj.offsetParent )
        {
          while( 1 ) 
          {
              curleft += obj.offsetLeft;
              if( !obj.offsetParent )
              {
                  break;
              }
              obj = obj.offsetParent;
          }
        }
        else 
        if( obj.x )
        {
            curleft += obj.x;
        }
    
        return curleft;
    }

    D.findPosY = function ( obj )
    {
        var curtop = 0;
    
        if( obj.offsetParent )
        {
            while( 1 )
            {
                curtop += obj.offsetTop;
                if( !obj.offsetParent )
                {
                    break;
                }
                obj = obj.offsetParent;
            }
        }
        else 
        if( obj.y )
        {
            curtop += obj.y;
        }
    
        return curtop;
    }

}) ( DESANTI );
